﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhuKien_Entry.ascx.cs" Inherits="cbmobile.UserControl.PhuKien_Entry" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>

<script type="text/javascript">

    var activeArea = null;
    var winW = 0;
    var winH = 0;
    var clickX = 0;
    var clickY = 0;
    function GetWindowSize() {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            winH = document.body.clientHeight;
            winW = document.body.clientWidth;
        } else {
            winH = window.innerHeight;
            winW = window.innerWidth;
        }
    }
    function GetMouseXY(e) {
        if (navigator.appName.indexOf("Microsoft") != -1) { // grab the x-y pos.s if browser is IE
            clickX = e.clientX + document.body.scrollLeft
            clickY = e.clientY + document.body.scrollTop
        } else {  // grab the x-y pos.s if browser is NS
            clickX = e.pageX
            clickY = e.pageY
        }
        // catch possible negative values in NS4
        if (clickX < 0) clickX = 0;
        if (clickY < 0) clickY = 0;
        return true
    }

    function AreaContains(parent, child) {
        while (child)
            if (parent == child) return true;
            else
                child = child.parentNode;

        return false;
    }
    function PopupAreaMouseOut(e) {
        if (!e)
            var e = window.event;
        var targ = e.relatedTarget ? e.relatedTarget : e.toElement;
        if (activeArea != null && !AreaContains(activeArea, targ)) {
            activeArea.style.display = 'none';
            activeArea = null;
        }
    }

    function PopupArea(e) {
        // get viewing size 
        GetWindowSize();
        GetMouseXY(e);

        // hide the old area
        if (activeArea != null) {
            activeArea.style.display = 'none';
        }

        // pop-up area
        var popupArea = document.getElementById("divImageProduct");
        popupArea.style.position = 'absolute';
        popupArea.style.display = 'inline';
        popupArea.style.zIndex = "9999";
        popupArea.style.top = clickY - 78 + 'px';
        popupArea.style.left = clickX + 10 + 'px';

        popupArea.onmouseout = PopupAreaMouseOut;
        document.body.appendChild(popupArea);

        // keep the pop-up area
        activeArea = popupArea;
    }

    function ShowImage(event, isShow) {

        if (isShow == 0) {
            document.getElementById("divImageProduct").style.display = 'none';
            return false;
        } else {
            PopupArea(event);
            return false;
        }

    }

</script>


<script type="text/javascript">
    function validateChooseDropList(oSrc, args) {
        args.IsValid = (args.Value != '0');
    }
</script>

<div class="sb-box">
    <div class="header">
        <h3>
            Thông tin Sản phẩm</h3>
    </div>
    <div class=" clear">
    </div>
    <div class="bcont">
        <div class="selection">
            
            <asp:FormView ID="frmBlogCate" runat="server" DataSourceID="ObjectDataSource1" 
                ondatabound="frmBlogCate_DataBound" onitemdeleted="frmBlogCate_ItemDeleted" 
                oniteminserted="frmBlogCate_ItemInserted">
                <EditItemTemplate>
                    <table border="0">
                        <tr>
                            <td class="setup01">
                                Mã Phụ Kiện
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMaPK" CssClass="inputtext medium" runat="server" Text='<%# Bind("Ma_PhuKien") %>' />
                                <asp:RequiredFieldValidator ID="rfilName" runat="server" ErrorMessage=" Mã phụ kiện không được để trống !" ForeColor="red" ControlToValidate="txtMaPK" ValidationGroup="CheckCategory"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Mã loại phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMaLoaiPK" Width="308px" runat="server" Text='<%# Bind("Ma_LoaiPhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Tên Phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtTenPK" CssClass="inputtext medium" runat="server" Text='<%# Bind("Ten_PhuKien") %>' />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage=" Tên không được để trống !" ForeColor="red" ControlToValidate="txtTenPK" ValidationGroup="CheckCategory"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Trạng thái
                            </td>
                            <td class="setup02">
                               <asp:DropDownList ID="ddlStatus" runat="server" >
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Chất liệu
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtChatLieu"  Width="308px" runat="server" Text='<%# Bind("ChatLieu") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Màu Sắc
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMauSac"  Width="308px" runat="server" Text='<%# Bind("MauSac") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Nguyên hộp
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtNguyenHop"  Width="308px" runat="server" Text='<%# Bind("NguyenHop") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Bảo hành
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtBaoHanh"  Width="308px" runat="server" Text='<%# Bind("BaoHanh") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Giá
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtGia"  Width="308px" runat="server" Text='<%# Bind("Gia") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Hình ảnh
                            </td>
                            <td class="setup02">
                                <span style="float: left; margin-right: 10px;">
                                    <asp:FileUpload ID="fileImage" runat="server" Width="90%" />
                                </span>
                                <span onmouseover="return ShowImage(event, 1);" onmouseout="return ShowImage(event, 0);" style="float: left;">
                                    <asp:Label ID="lblImage" runat="server" ForeColor="BlueViolet" Style="cursor: pointer" Text='<%#Bind("HinhAnh") %>' ></asp:Label>
                                </span>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Only png, jpeg,jpg or gif files are allowed!"
                                    Display="None" ValidationGroup="CheckProduct" ValidationExpression="^(\w.*)+(.png|.PNG|.jpeg|.JPEG|.jpg|.JPG|.gif|.GIF)$"
                                    ControlToValidate="fileImage">
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Mô tả
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMoTa" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("MoTa") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Bài viết
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtBaiViet" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("BaiViet") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Ngày tạo
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtNgayTao" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("NgayTao") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="C pdT10" colspan="2">
                                <asp:LinkButton ID="EditButton" ValidationGroup="CheckCategory" runat="server" CausesValidation="True"
                                    CommandName="Update" Text="Edit" CssClass="button"><span>Update</span></asp:LinkButton>
                                &nbsp;&nbsp;&nbsp;<a href='<%=this.ListLink %>' class="button"><span>Cancel</span></a>
                            </td>
                        </tr>
                    </table>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <table border="0">
                        <tr>
                            <td class="setup01">
                                Mã loại Phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMaLoaiLK" Width="308px" runat="server" Text='<%# Bind("Ma_LoaiPhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Tên Phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtTenPhuKien" CssClass="inputtext medium" runat="server" Text='<%# Bind("Ten_PhuKien") %>' />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage=" Tên không được để trống !" ForeColor="red" ControlToValidate="txtTenPhuKien" ValidationGroup="CheckCategory"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Trạng thái
                            </td>
                            <td class="setup02">
                               <asp:DropDownList ID="ddlStatus" runat="server" >
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Chất liệu
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtChatLieu"  Width="308px" runat="server" Text='<%# Bind("ChatLieu") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Màu Sắc
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMauSac"  Width="308px" runat="server" Text='<%# Bind("MauSac") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Nguyên hộp
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtNguyenHop"  Width="308px" runat="server" Text='<%# Bind("NguyenHop") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Bảo hành
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtBaoHanh"  Width="308px" runat="server" Text='<%# Bind("BaoHanh") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Giá
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtGia"  Width="308px" runat="server" Text='<%# Bind("Gia") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Hình ảnh
                            </td>
                            <td class="setup02">
                                <span style="float: left; margin-right: 10px;">
                                    <asp:FileUpload ID="fileImage" runat="server" Width="90%" />
                                </span>
                                <span onmouseover="return ShowImage(event, 1);" onmouseout="return ShowImage(event, 0);" style="float: left;">
                                    <asp:Label ID="lblImage" runat="server" ForeColor="BlueViolet" Style="cursor: pointer" Text='<%#Bind("HinhAnh") %>' ></asp:Label>
                                </span>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Only png, jpeg,jpg or gif files are allowed!"
                                    Display="None" ValidationGroup="CheckProduct" ValidationExpression="^(\w.*)+(.png|.PNG|.jpeg|.JPEG|.jpg|.JPG|.gif|.GIF)$"
                                    ControlToValidate="fileImage">
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Mô tả
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtMoTa" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("MoTa") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Bài viết
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtBaiViet" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("BaiViet") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Ngày tạo
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtNgayTao" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("NgayTao") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="C pdT10" colspan="2">
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CssClass="button"
                        CommandName="Insert" Text="Insert" ><span>Insert</span></asp:LinkButton>
                    &nbsp;<a href='<%=this.ListLink %>' class="button"><span>Cancel</span></a>
                            </td>
                        </tr>
                    </table>
                </InsertItemTemplate>
                <ItemTemplate>
                    <table border="0">
                        <tr>
                            <td class="setup01">
                                Mã Phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblName" CssClass="inputtext medium" runat="server" Text='<%# Bind("Ma_PhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Mã loại Phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblMaLoaiLK" Width="308px" runat="server" Text='<%# Bind("Ma_LoaiPhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Tên Phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblTenPhuKien" CssClass="inputtext medium" runat="server" Text='<%# Bind("Ten_PhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Trạng thái
                            </td>
                            <td class="setup02">
                               <asp:Label ID="lbl_Stt" runat="server" Text='<%#Bind("TinhTrang") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Chất liệu
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblChatLieu"  Width="308px" runat="server" Text='<%# Bind("ChatLieu") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Màu Sắc
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblMauSac"  Width="308px" runat="server" Text='<%# Bind("MauSac") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Nguyên hộp
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblNguyenHop"  Width="308px" runat="server" Text='<%# Bind("NguyenHop") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Bảo hành
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblBaoHanh"  Width="308px" runat="server" Text='<%# Bind("BaoHanh") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Giá
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblGia"  Width="308px" runat="server" Text='<%# Bind("Gia") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Hình ảnh
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblHinhAnh" runat="server" Text='<%# Bind("HinhAnh") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Mô tả
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblMoTa" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("MoTa") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Bài viết
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblBaiViet" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("BaiViet") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Ngày tạo
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblNgayTao" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("NgayTao") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="C pdT10" colspan="2">
                                <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CssClass="button"
                        CommandName="Edit" Text="Edit" ><span>Edit</span></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CssClass="button" OnClientClick='return confirm("Do you want delete this item?");'
                        CommandName="Delete" ><span>Delete</span></asp:LinkButton>
                    &nbsp;<a href='<%=this.ListLink %>' class="button"><span>Cancel</span></a>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:FormView>
        </div>
    </div>
</div>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
    DeleteMethod="Delete" InsertMethod="Create" SelectMethod="Get_PhuKien_By_ID" 
    TypeName="cbmobile.BLC.BLC_PhuKien" UpdateMethod="Update" 
    oninserting="ObjectDataSource1_Inserting" 
    onupdating="ObjectDataSource1_Updating">
    <DeleteParameters>
        <asp:QueryStringParameter DefaultValue="0" Name="Ma_PhuKien" 
            QueryStringField="Ma_PhuKien" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Ma_LoaiPhuKien" Type="Int32" />
        <asp:Parameter Name="Ten_PhuKien" Type="String" />
        <asp:Parameter Name="TinhTrang" Type="Int32" />
        <asp:Parameter Name="ChatLieu" Type="String" />
        <asp:Parameter Name="MauSac" Type="String" />
        <asp:Parameter Name="NguyenHop" Type="String" />
        <asp:Parameter Name="BaoHanh" Type="String" />
        <asp:Parameter Name="Gia" Type="Decimal" />
        <asp:Parameter Name="SoLuotXem" Type="Int32" />
        <asp:Parameter Name="MoTa" Type="String" />
        <asp:Parameter Name="BaiViet" Type="String" />
        <asp:Parameter Name="HinhAnh" Type="String" />
    </InsertParameters>
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="0" Name="Ma_PhuKien" 
            QueryStringField="Ma_PhuKien" Type="Int32" />
    </SelectParameters>
    <UpdateParameters>
        <asp:QueryStringParameter DefaultValue="0" Name="Ma_PhuKien" 
            QueryStringField="Ma_PhuKien" Type="Int32" />
        <asp:Parameter Name="Ma_LoaiPhuKien" Type="Int32" />
        <asp:Parameter Name="Ten_PhuKien" Type="String" />
        <asp:Parameter Name="TinhTrang" Type="Int32" />
        <asp:Parameter Name="ChatLieu" Type="String" />
        <asp:Parameter Name="MauSac" Type="String" />
        <asp:Parameter Name="NguyenHop" Type="String" />
        <asp:Parameter Name="BaoHanh" Type="String" />
        <asp:Parameter Name="Gia" Type="Decimal" />
        <asp:Parameter Name="SoLuotXem" Type="Int32" />
        <asp:Parameter Name="MoTa" Type="String" />
        <asp:Parameter Name="BaiViet" Type="String" />
        <asp:Parameter Name="HinhAnh" Type="String" />
    </UpdateParameters>
</asp:ObjectDataSource>

